package cn.itcast.travel.web.servlet.blog;

import cn.itcast.travel.service.BlogService;
import cn.itcast.travel.service.impl.BlogServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "addclick", value = "/addclick")
public class addclick extends HttpServlet {
    BlogService service=new BlogServiceImpl();
    //增加点击量
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id=request.getParameter("id");
        ObjectMapper ob=new ObjectMapper();
        service.addclick(id);
        ob.writeValue(response.getWriter(),1);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
